<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.PreparedStatement" %><%--
  Created by IntelliJ IDEA.
  User: B3300
  Date: 2023/4/15
  Time: 9:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>添加处理</title>
</head>
<body>
<%
    String uid = request.getParameter("uid");
    String uname = request.getParameter("uname");
    String upwd = request.getParameter("upwd");

    Class.forName("com.mysql.jdbc.Driver");
    String url = "jdbc:mysql://127.0.0.1:3306/dbnews";
    String username = "root";
    String password = "1234";

    Connection connection = DriverManager.getConnection(url, username, password);
    String sql = "insert into user(userid,username,userpwd) VALUES (?,?,?)";
    PreparedStatement preparedStatement = connection.prepareStatement(sql);
    preparedStatement.setString(1,uid);
    preparedStatement.setString(2,uname);
    preparedStatement.setString(3,upwd);
    int i = preparedStatement.executeUpdate();
    if (i > 0) {
        out.print("请增加功能!!");
    }

%>
</body>
</html>
